package com.itheima.task;

/**
 * @description: 定时器
 * @author: wangjingliang
 * @create: 2019-11-14 09:53
 **/
//@Component
public class TaskDemo {
   /* @Autowired
    private RedisTemplate redisTemplate;

    @Scheduled(cron = "0/10 * * * * ?")
    public void clearImp(){
        System.out.println("打印时间"+ new Date());
        //根据redis中保存的两个set集合进行差值计算,获得垃圾图片名称的集合
        Set<String> sdiffs = redisTemplate.boundSetOps(RedisConstant.SETMEAL_PIC_RESOURCES).diff( RedisConstant.SETMEAL_PIC_DB_RESOURCES);
        for (String sdiff : sdiffs) {
            if (sdiff!=null||sdiff.trim()!=""){
                //删除阿里云上垃圾图片
                ALiYunUtils.deleteFile(sdiff,null);
            }
        }
        //删除redis中是储存图片名
        redisTemplate.boundSetOps(RedisConstant.SETMEAL_PIC_RESOURCES).remove(sdiffs.toArray());
    }*/
}